<?php

namespace Acme\UserBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

use Symfony\Component\Validator\Constraints as Assert;

// DON'T forget this use statement!!!
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;

/**
 * Acme\UserBundle\Entity\CmUserInfo
 *
 * @ORM\Table(name="cm_user_info")
 * @ORM\Entity(repositoryClass="Acme\UserBundle\Repository\UserInfoRepository")
 * @ORM\HasLifecycleCallbacks()
 */
class CmUserInfo
{
    /**
     * @var integer $id
     *
     * @ORM\Column(name="id", type="integer", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * @var integer $userId
     *
     * @ORM\Column(name="user_id", type="integer", nullable=true)
     */
    private $userId;

    /**
     * @var string $name
     *
     * @ORM\Column(name="name", type="string", length=255, nullable=true)
     * 
     * @Assert\NotBlank(
     * 		message = "请输入您的真实姓名",
     * 		groups={"regist_student", "regist_teacher"}
     * )
     * @Assert\MinLength(
     * 		limit=2,
     * 		message="姓名长度最少为 {{ limit }} 位字符",
     * 		groups={"regist_default"}
     * )
     * @Assert\MaxLength(limit=4,
     * 		message="姓名长度最多为 {{ limit }} 位字符",
     * 		groups={"regist_default"}
     * )
     * @Assert\Regex(
     * 		pattern="/[^x00-xff]+$/",
     * 		message="姓名只能由中文组成",
     * 		groups={"regist_default"}
     * )
     */
    private $name;

    /**
     * @var string $gender
     *
     * @ORM\Column(name="gender", type="string", length=1, nullable=true)
     * 
     * @Assert\NotBlank(
     * 		message = "请选择您的性别",
     * 		groups={"regist_student", "regist_teacher"}
     * )
     */
    private $gender;

    /**
     * @var date $birth
     *
     * @ORM\Column(name="birth", type="date", nullable=true)
     * 
     * @Assert\NotBlank(
     * 		message = "请选择您的生日",
     * 		groups={"regist_student", "regist_teacher"}
     * )
     * @Assert\Date()
     */
    private $birth;

    /**
     * @var integer $stuNum
     *
     * @ORM\Column(name="stu_num", type="integer", nullable=true)
     * 
     * @Assert\NotBlank(
     * 		message = "请输入您的学号",
     * 		groups={"regist_student"}
     * )
     * @Assert\Regex(
     * 		pattern="/\d$/",
     * 		message="学号格式错误",
     * 		groups={"regist_default"}
     * )
     */
    private $stuNum;

    /**
     * @var integer $university
     *
     * @ORM\Column(name="university", type="integer", nullable=true)
     * 
     * @Assert\NotBlank(
     * 		message = "请选择您的所在大学",
     * 		groups={"regist_student", "regist_teacher"}
     * )
     */
    private $university;

    /**
     * @var bigint $phone
     *
     * @ORM\Column(name="phone", type="bigint", nullable=true)
     * 
     * @Assert\NotBlank(
     * 		message = "请输入您的手机号码",
     * 		groups={"regist_student", "regist_teacher"}
     * )
     * @Assert\Regex(
     * 		pattern="/^(13[0-9]|15[0|3|6|7|8|9]|18[8|9])\d{8}$/",
     * 		message="手机号码格式错误",
     * 		groups={"regist_default"}
     * )
     */
    private $phone;

    /**
     * @var bigint $qq
     *
     * @ORM\Column(name="qq", type="bigint", nullable=true)
     * 
     * @Assert\NotBlank(
     * 		message = "请输入您的QQ号",
     * 		groups={"regist_student", "regist_teacher"}
     * )
     * @Assert\Regex(
     * 		pattern="/^[1-9]*[1-9][0-9]*$/",
     * 		message="QQ号格式错误",
     * 		groups={"regist_default"}
     * )
     */
    private $qq;

    /**
     * @var bigint $idCard
     *
     * @ORM\Column(name="id_card", type="bigint", nullable=true)
     * 
     * @Assert\NotBlank(
     * 		message = "请输入您的身份证号",
     * 		groups={"regist_student", "regist_teacher"}
     * )
     * @Assert\Regex(
     * 		pattern="/^(\d{18,18}|\d{15,15}|\d{17,17}x)$/",
     * 		message="身份证号格式错误",
     * 		groups={"regist_default"}
     * )
     */
    private $idCard;
    
    /**
     * @var string $flag
     *
     * @ORM\Column(name="flag", type="string", length=1, nullable=true)
     */
    private $flag;
    
    /**
     * Owning Side
     * @ORM\OneToOne(targetEntity="CmUser", inversedBy="userInfo")
     * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
     */
    protected $user;

    /**
     * Owning Side
     * @ORM\ManyToOne(targetEntity="\Acme\CommonBundle\Entity\ConstUniversity", inversedBy="users")
     * @ORM\JoinColumn(name="university", referencedColumnName="id")
     */
    protected $universityInfo;


    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set userId
     *
     * @param integer $userId
     */
    public function setUserId($userId)
    {
        $this->userId = $userId;
    }

    /**
     * Get userId
     *
     * @return integer 
     */
    public function getUserId()
    {
        return $this->userId;
    }

    /**
     * Set name
     *
     * @param string $name
     */
    public function setName($name)
    {
        $this->name = $name;
    }

    /**
     * Get name
     *
     * @return string 
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Set gender
     *
     * @param string $gender
     */
    public function setGender($gender)
    {
        $this->gender = $gender;
    }

    /**
     * Get gender
     *
     * @return string 
     */
    public function getGender()
    {
        return $this->gender;
    }

    /**
     * Set birth
     *
     * @param date $birth
     */
    public function setBirth($birth)
    {
        $this->birth = $birth;
    }

    /**
     * Get birth
     *
     * @return date 
     */
    public function getBirth()
    {
        return $this->birth;
    }

    /**
     * Set stuNum
     *
     * @param integer $stuNum
     */
    public function setStuNum($stuNum)
    {
        $this->stuNum = $stuNum;
    }

    /**
     * Get stuNum
     *
     * @return integer 
     */
    public function getStuNum()
    {
        return $this->stuNum;
    }

    /**
     * Set university
     *
     * @param integer $university
     */
    public function setUniversity($university)
    {
        $this->university = $university;
    }

    /**
     * Get university
     *
     * @return integer 
     */
    public function getUniversity()
    {
        return $this->university;
    }

    /**
     * Set phone
     *
     * @param bigint $phone
     */
    public function setPhone($phone)
    {
        $this->phone = $phone;
    }

    /**
     * Get phone
     *
     * @return bigint 
     */
    public function getPhone()
    {
        return $this->phone;
    }

    /**
     * Set qq
     *
     * @param bigint $qq
     */
    public function setQq($qq)
    {
        $this->qq = $qq;
    }

    /**
     * Get qq
     *
     * @return bigint 
     */
    public function getQq()
    {
        return $this->qq;
    }

    /**
     * Set idCard
     *
     * @param bigint $idCard
     */
    public function setIdCard($idCard)
    {
        $this->idCard = $idCard;
    }

    /**
     * Get idCard
     *
     * @return bigint 
     */
    public function getIdCard()
    {
        return $this->idCard;
    }
    
    /**
     * Set flag
     *
     * @param string $flag
     * 
     * @ORM\prePersist
     */
    public function setFlag($flag = 0)
    {
    	$this->flag = $flag;
    }
    
    /**
     * Get flag
     *
     * @return string
     */
    public function getFlag()
    {
    	return $this->flag;
    }

    /**
     * Set user
     *
     * @param Acme\UserBundle\Entity\CmUser $user
     */
    public function setUser(\Acme\UserBundle\Entity\CmUser $user)
    {
        $this->user = $user;
    }

    /**
     * Get user
     *
     * @return Acme\UserBundle\Entity\CmUser 
     */
    public function getUser()
    {
        return $this->user;
    }

    /**
     * Set universityInfo
     *
     * @param Acme\CommonBundle\Entity\ConstUniversity $universityInfo
     */
    public function setUniversityInfo(\Acme\CommonBundle\Entity\ConstUniversity $universityInfo)
    {
        $this->universityInfo = $universityInfo;
    }

    /**
     * Get universityInfo
     *
     * @return Acme\CommonBundle\Entity\ConstUniversity 
     */
    public function getUniversityInfo()
    {
        return $this->universityInfo;
    }
}